<?php
class Controllers_DejaSoumis extends RestController {
    public function get() {
        $this->response = array('TestResponse' => null);
        $this->responseStatus = 501;
    }

    public function post() {
        require_once("Config/connexion.php");
        
        require_once("Fonctions/authentification.php");
        require_once("Fonctions/soumissions.php");
        
        $params = $this->request['params'];
        
        $responseStatus = 200;
                
        $authok = estAuthentifie($params["userid"], $params["authkey"]);
            
        $villeDejaValidee = false;
        
        if ($authok) {
            $villeDejaValidee = villeDejaValidee($params["userid"], $params["city_postal_code"] ,$params["city_name"], $params["country_name"]);
        }
        else {
             $responseStatus = 403;
        }
        
        //$this->response = array('Response' => $selectSoumis);
        $this->response = array('Response' => $villeDejaValidee  ? 'true' : 'false');
        $this->responseStatus = $responseStatus;
    }
    public function put() {
            $this->response = array('TestResponse' => null);
            $this->responseStatus = 501;
    }

    public function delete() {
            $this->response = array('TestResponse' => null);
            $this->responseStatus = 501;
    }
        
}